package com.nclg.exam.mapper;

import com.nclg.exam.dto.ExamPaperDto;
import com.nclg.exam.dto.PaperHistoryDto;
import com.nclg.exam.entity.TUserAnswer;
import com.nclg.exam.entity.TUserPaper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface ExamMapper {
    /**
     * 查询正在考试的试卷
     * @return
     */
    List<ExamPaperDto> selectExamPaperByPage();

    /**
     * 查询考试历史
     * @param uId
     * @return
     */
    List<PaperHistoryDto> selectExamFinishedPaperByPage(Long uId);

    /**
     * 是否提交过试卷
     * @param pId
     * @param uId
     * @return
     */
    int selectIsFinished(@Param("pId") Long pId, @Param("uId") Long uId);

    /**
     * 提交试卷
     * @param userPaper
     * @return
     */
    int insertUserPaper(TUserPaper userPaper);

    /**
     * 插入答案
     * @param userAnswer
     * @return
     */
    int insertUserAnswer(TUserAnswer userAnswer);

    /**
     * 查询用户答案
     * @param upId
     * @return
     */
    String selectUserAnswer(Long upId);
}
